<?php

namespace App\Transformers\Web;

use League\Fractal\TransformerAbstract;

class ResultTransformer extends TransformerAbstract
{
    public function transform( $result)
    {
        return [
            'fraction' => $result->fraction,
            'success_num' => $result->success_num,
            'error_num' => $result->error_num,
            'end_time' => $result->end_time,
            'submit_type' => $result->submit_type,
            'all_num' => $result->all_num,
            'already_num' => $result->already_num,
            'unanswered_num' => ($result->all_num) - ($result->already_num),
            'examination_name' => $result->examination->name,
            'start_time' => $result->examination->start_time,
            'type' => $result->examination->type,
        ];
    }
}

